#include <all_wlib.h>
#pragma hdrstop
//#pragma package(smart_init)
#pragma resource "*.dfm"
#pragma link "HWindow"
#pragma link "ozf_Base"

#include "ozf_Test.h"

DEF_SWITCH( Test )

//---------------------------------------------------------------------------
__fastcall TTestForm::TTestForm(TComponent* Owner)
    : TOziBaseForm( Owner )
  {
//CFG
     Init( "Test", (TForm**)&Form );
}

void __fastcall TTestForm::idPos( double Lat,double Lon,double Speed,double Head,double Mag,double Alt, int x, int y )
  {
#define SET( v ) txt##v->Caption = v
        SET( Lat );
        SET( Lon );
        SET( Speed );
        SET( Head );
        SET( Mag );
        SET( Alt );
#undef SET

        char *m;
        int   len;
        char *zone, *dat;
        double e, n;
        double cLon;

        cLon = ((int)Lon) / 3;
        cLon = cLon * 3 + 3;

        m = NULL;
        oziConvertLL2Grid( 1/*Universal Transverse Mercator*/, Lat, Lon, m, zone, e, n,
                           0, cLon, 0, 0, 1, 500000, 0 );

        m = NULL;
        oziGetMapDatum( m, len );
        txtDatumn->Caption = Message( "%s: %s", m, zone );
        txtText->Caption   = Message( "N: %3.3lf\nE: %3.3lf", n, e );
}
//---------------------------------------------------------------------------
void __fastcall TTestForm::FormClose(TObject *Sender, TCloseAction &Action)
  {
  //CFG

  //Base
     TOziBaseForm::FormClose( Sender, Action );
}
//---------------------------------------------------------------------------
